package com.wyx;

import com.wyx.mapper.StoreMapper;
import com.wyx.pojo.Store;
import org.apache.commons.codec.digest.DigestUtils;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.security.SecureRandom;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.UUID;

/**
 * @author 吴宇~
 * @motto 我亦无他，唯手熟尔。
 * @edition jdk1.8
 * @reflection 0-1 喧闹任其喧闹，自由我自为之，我自风情万种，与世无争。
 * @date 2024/05/12/16:19
 * @target 心若有所向往，何惧道阻且长   之前仓库没有提交，不需要push
 */
@SpringBootTest
public class insertStore {
    @Autowired
    private StoreMapper storeMapper;

    @Test
    public void insert(){
        Store store = new Store();
        char salt = (char) (new SecureRandom().nextInt(94) + 33);
        String password = "@Wy123456";
        String newPassword = password+salt;
        String  encipherPassword = DigestUtils.md5Hex(newPassword).toUpperCase();
        store.setId(UUID.randomUUID().toString().replace("-",""));
        store.setLinkageId(UUID.randomUUID().toString().replace("-",""));
        store.setSmokeCertificateId("140105123306");
        store.setStoreName("武建平便利店");
        store.setSmokeEncipherSalt(String.valueOf(salt));
        store.setSmokeEncipherPassword(encipherPassword);
        store.setAddressProvince("山西");
        store.setAddressCity("太原");
        store.setAddressCounty("小店");
        store.setAddressExpand("刘家堡乡");
        store.setAddressExpand("西林林村南外环中间位置");
        store.setCreateId("2");
        store.setUpdateId("22");
        store.setCreateTime(LocalDateTime.now());
        store.setUpdateTime(LocalDateTime.now());
        storeMapper.insert(store);
    }
}
